param( [string] $SourceDir=$(Throw "Parameter SourceDir is required")
     , [string] $DestinationDir=$(Throw "Parameter DestinationDir is required")
     #, [string] $SyncPackageDir=$(Throw "Parameter SyncPackageDir is required")
     , [switch] $Whatif
     , [switch]	$Force
     )

begin
{
	$SourcePath = (Get-Item $SourceDir).FullName
	$DestinationPath = (Get-Item $DestinationDir).FullName
	
	$SourceManifest = dir $SourcePath -recurse | Set-ManifestXML $SourcePath
	$DestinationManifest = dir $DestinationPath -recurse | Set-ManifestXML $DestinationPath

	$manDiff = Get-ManifestDiff -SourceManifest $SourceManifest -DestinationManifest $DestinationManifest

	$scriptArray = Create-SyncScript $manDiff $SourcePath $DestinationPath -WhatIf:$WhatIf -Force:$Force
    
    $sb = New-Object "system.text.stringbuilder"
    $scriptArray | %{[void]$sb.AppendLine($_)}
    $Script = $sb.ToString()
    
    $Script | Set-Content "Temp.ps1"
    Invoke-Expression $script
}